home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_01_02
/
1n02025b
< prev
next >
Wrap
Text File
|
1990-07-08
|
2KB
|
45 lines
#include <stdio.h>
/******************************************************************
* lj_bar3d - draw a 3 dimensional bar for a bar chart
*
* Parameters:
* left (in) - left edge of bar in dots
* top (in) - top edge of bar in dots
* right (in) - right edge of bar in dots
* bottom (in) - bottom edge of bar in dots
* pattern (in) - fill pattern to use
* depth (in) - depth of 3 dimensional effect in dots
* topflag (in) - true for top bar, false for others
*
* Notes:
* 1. A depth equal to 25% of the width works out well.
*
* 2. Valid patterns are 1 through 6.
*
* Copyright:
* Original code by William H. Roetzheim (619) 669-6970
**********************************************************************/
void lj_bar3d(int left, int top, int right, int bottom, int pattern,
int depth, int topflag)
{
/* first draw body of bar */
fprintf(stdprn, "\033*p%dx%dY", left, top); /* position cursor */
fprintf(stdprn, "\033*c%dA", right - left); /* bar width */
fprintf(stdprn, "\033*c%dB", bottom - top); /* bar height */
fprintf(stdprn, "\033*c%dG", pattern); /* pattern */
fprintf(stdprn, "\033*c3P"); /* print the bar */
/* now draw the 3d effect */
if (topflag)
{
lj_line(left, top, left + depth, top - depth);
lj_line(left + depth, top - depth, right + depth, top - depth);
lj_line(right + depth, top - depth, right, top);
lj_line(right + depth, top - depth, right + depth, bottom - depth);
}
}